package com.sky.service.impl;

import com.sky.dao.AccountDao;
import com.sky.service.AccountService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service("accountService")
@Transactional
public class AccountServiceImpl implements AccountService {

    @Resource
    private AccountDao accountDao;

    @Override
    public void transfer(String outMan, String inMan, double money) {
        //开启事务
        accountDao.out(outMan, money);
        int i = 1 / 0;
        accountDao.in(inMan, money);
        //提交事务
    }
}
